package com.smh.a09Clonedemo9;

public class Test {
    public static void main(String[] args) {
        StudentClone studentClone = new StudentClone();

        StudentClone student = studentClone.clone();

        System.out.println(studentClone);
        System.out.println(student);
        Object o = new Object();
        o.toString();
        student.setName("sada");
        System.out.println(student);
        System.out.println(studentClone);
        //浅克隆是直接拷贝对象地址
        //深克隆会创建新的引用对象
        for (int i = 0; i < studentClone.getArr().length; i++) {
            System.out.print(studentClone.getArr()[i]);
        }
        int[] arr2 = studentClone.getArr();
        arr2[0]=1000;
//        int[] arr = {1,23,4,5,6,7};
//        studentClone.setArr(arr);
        System.out.println();
        for (int i = 0; i < studentClone.getArr().length; i++) {
            System.out.print(studentClone.getArr()[i]);
        }
        System.out.println(arr2);
        System.out.println(studentClone.getArr());
        System.out.println(student.getArr());
        System.out.println();
        for (int i = 0; i < student.getArr().length; i++) {
            System.out.print(student.getArr()[i]);
        }
        System.out.println();

    }
}
